function setHeight(){
	var height = $('#content').height();
	$('#email').height(height);
}

function changeEmail(){
	var name = prompt("Enter in a new email.  Your email will be updated after you receive the confirmation email and follow the link.", "");
	
	if (name != null && name != ""){
		document.forms["email_change"]["email"].value = name	

		document.forms["email_change"].action = "changeEmail.php";
		document.forms["email_change"].submit();
	}
}

function validateForm(){
	var name = document.forms["sign_up"]["uname"].value;
	var email = document.forms["sign_up"]["email"].value;
	var pass = document.forms["sign_up"]["pass"].value;
	var pass2 = document.forms["sign_up"]["pass2"].value;
	
	if(name == null || name == ""){
		alert('Please enter in a valid username!');
		return;
	}
	
	if(email == null || email == "" || !validateEmail(email)){
		alert('Please enter in a valid email address!');
		return;
	}
	
	if(pass2 == null || pass2 == "" || pass == null || pass == ""){
		alert('Please enter in a password!');
		return;
	}
	
	if(pass != pass2){
		alert('The passwords don\'t match!');
		return;
	}
	
	document.forms["sign_up"].action = "signup.php";
	document.forms["sign_up"].submit();
}

function validateThread(){
	var topic = document.forms["new_thread"]["topic"].value;
	var comment = document.forms["new_thread"]["comment"].value;
	
	if(topic == "" || topic == null){
		alert('Topic Can\'t Be Blank!');
	}
	
	if(comment == "" || comment == null){
		alert('Initial Comment Can\'t Be Blank!');
	}
	
	document.forms["new_thread"].action = "newthread.php";
	document.forms["new_thread"].submit();
}

function validateEmail(x){	
	var atpos = x.indexOf("@");
	var dotpos = x.lastIndexOf(".");
	
	if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= x.length){
		return false;
	}

	return true;
}